package com.zzy.demo.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zzy.demo.common.exception.BizException;
import com.zzy.demo.common.validate.BeanValidator;
import com.zzy.demo.service.UserService;
/**
 * 
 * @author guokaige
 *
 */
@Controller
public class TestController {
	
	@Autowired
	UserService  userSerivce;


	@RequestMapping("/add.page")
	public String index(User user,Model model) {
		
		BeanValidator.check(user);
		
		userSerivce.testService();
		
		return "index";
	}

	
	@RequestMapping("/exception.json")
	public String exception() {
		
		 throw new BizException("测试异常");
		 
	}
	
}
